<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Zend_Service_Amazon_Ec2: Amazon Machine Images (AMI) - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.service.amazon.ec2.images.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.service.amazon.ec2.images.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.service.amazon.ec2.cloudwatch.html">Zend_Service_Amazon_Ec2: CloudWatch Monitoring</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.service.html">Zend_Service</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.service.amazon.ec2.ebs.html">Zend_Service_Amazon_Ec2: Elastic Block Storage (EBS)</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.service.amazon.ec2.images" class="section"><div class="info"><h1 class="title">Zend_Service_Amazon_Ec2: Amazon Machine Images (AMI)</h1></div>
    

    <p class="para">
        Amazon Machine Images (AMIs) are preconfigured with an ever-growing list
        of operating systems.
    </p>

    <div class="section" id="zend.service.amazon.ec2.images.info"><div class="info"><h1 class="title">AMI Information Utilities</h1></div>
        

        <div class="example" id="zend.service.amazon.ec2.images.register"><div class="info"><p><b>Example #1 Register an AMI with EC2</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">register</code> Each <acronym class="acronym">AMI</acronym> is associated with an unique ID
                which is provided by the Amazon EC2 service through the RegisterImage
                operation. During registration, Amazon EC2 retrieves the specified
                image manifest from Amazon S3 and verifies that the image is owned by
                the user registering the image.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">register</code> returns the imageId for the registered Image.
            </p></div>

            <pre class="programlisting brush: php">
$ec2_img = new Zend_Service_Amazon_Ec2_Image(&#039;aws_key&#039;,&#039;aws_secret_key&#039;);
$ip = $ec2_img-&gt;register(&#039;imageLocation&#039;);
</pre>

        </div>

        <div class="example" id="zend.service.amazon.ec2.images.deregister"><div class="info"><p><b>Example #2 Deregister an AMI with EC2</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">deregister</code>, Deregisters an <acronym class="acronym">AMI</acronym>. Once deregistered,
                instances of the <acronym class="acronym">AMI</acronym> can no longer be launched.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">deregister</code> returns boolean <b><tt>TRUE</tt></b> or
                <b><tt>FALSE</tt></b>.
            </p></div>

            <pre class="programlisting brush: php">
$ec2_img = new Zend_Service_Amazon_Ec2_Image(&#039;aws_key&#039;,&#039;aws_secret_key&#039;);
$ip = $ec2_img-&gt;deregister(&#039;imageId&#039;);
</pre>

        </div>

        <div class="example" id="zend.service.amazon.ec2.images.describe"><div class="info"><p><b>Example #3 Describe an AMI</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">describe</code> Returns information about <acronym class="acronym">AMI</acronym>s, AKIs, and
                ARIs available to the user. Information returned includes image type,
                product codes, architecture, and kernel and <acronym class="acronym">RAM</acronym> disk IDs. Images
                available to the user include public images available for any user
                to launch, private images owned by the user making the request,
                and private images owned by other users for which the user has
                explicit launch permissions.
            </p></div>

            <div class="example-contents"><p>
                <table id="zend.service.amazon.ec2.images.describe-table" class="doctable table"><div class="info"><caption><b>Launch permissions fall into three categories</b></caption></div>
                    

                    
                        <thead valign="middle">
                            <tr valign="middle">
                                <th>Name</th>
                                <th>Description</th>
                            </tr>

                        </thead>


                        <tbody valign="middle" class="tbody">
                            <tr valign="middle">
                                <td align="left"><code class="code">public</code></td>

                                <td align="left">
                                    <p class="para">
                                        The owner of the <acronym class="acronym">AMI</acronym> granted launch
                                        permissions for the <acronym class="acronym">AMI</acronym> to the all group.
                                        All users have launch permissions for these
                                        <b><tt>AMIs</tt></b>.
                                    </p>
                                </td>
                            </tr>


                            <tr valign="middle">
                                <td align="left"><code class="code">explicit</code></td>

                                <td align="left">
                                    <p class="para">
                                        The owner of the <acronym class="acronym">AMI</acronym> granted launch
                                        permissions to a specific user.
                                    </p>
                                </td>
                            </tr>


                            <tr valign="middle">
                                <td align="left"><code class="code">implicit</code></td>

                                <td align="left">
                                    <p class="para">
                                        A user has implicit launch permissions for all
                                        <b><tt>AMIs</tt></b> he or she owns.
                                    </p>
                                </td>
                            </tr>

                        </tbody>
                    
                </table>

            </p></div>

            <div class="example-contents"><p>
                The list of <acronym class="acronym">AMI</acronym>s returned can be modified by specifying
                <acronym class="acronym">AMI</acronym> IDs, <acronym class="acronym">AMI</acronym> owners, or users with launch
                permissions. If no options are specified, Amazon EC2 returns all
                <acronym class="acronym">AMI</acronym>s for which the user has launch permissions.
            </p></div>

            <div class="example-contents"><p>
                If you specify one or more <acronym class="acronym">AMI</acronym> IDs, only <acronym class="acronym">AMI</acronym>s
                that have the specified IDs are returned. If you specify an invalid
                <acronym class="acronym">AMI</acronym> ID, a fault is returned. If you specify an
                <acronym class="acronym">AMI</acronym> ID for which you do not have access, it will not be included
                in the returned results.
            </p></div>

            <div class="example-contents"><p>
                If you specify one or more <acronym class="acronym">AMI</acronym> owners, only
                <acronym class="acronym">AMI</acronym>s from the specified owners and for which you have access are
                returned. The results can include the account IDs of the specified owners, amazon
                for <acronym class="acronym">AMI</acronym>s owned by Amazon or self for <acronym class="acronym">AMI</acronym>s that
                you own.
            </p></div>

            <div class="example-contents"><p>
                If you specify a list of executable users, only users that have launch permissions
                for the <acronym class="acronym">AMI</acronym>s are returned. You can specify account IDs (if you
                own the <acronym class="acronym">AMI</acronym>(s)), self for <acronym class="acronym">AMI</acronym>s for which you
                own or have explicit permissions, or all for public <acronym class="acronym">AMI</acronym>s.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">describe</code> returns an array for all the images that match the critera
                that was passed in. The array contains the imageId, imageLocation, imageState,
                imageOwnerId, isPublic, architecture, imageType, kernelId, ramdiskId and platform.
            </p></div>

            <pre class="programlisting brush: php">
$ec2_img = new Zend_Service_Amazon_Ec2_Image(&#039;aws_key&#039;,&#039;aws_secret_key&#039;);
$ip = $ec2_img-&gt;describe();
</pre>

        </div>
    </div>

    <div class="section" id="zend.service.amazon.ec2.images.attribute"><div class="info"><h1 class="title">AMI Attribute Utilities</h1></div>
        

        <div class="example" id="zend.service.amazon.ec2.images.attribute.modify"><div class="info"><p><b>Example #4 Modify Image Attributes</b></p></div>
            

            <div class="example-contents"><p>Modifies an attribute of an <acronym class="acronym">AMI</acronym></p></div>

            <div class="example-contents"><p>
                <table id="zend.service.amazon.ec2.images.attribute.modify-table" class="doctable table"><div class="info"><caption><b>Valid Attributes</b></caption></div>
                    

                    
                        <thead valign="middle">
                            <tr valign="middle">
                                <th>Name</th>
                                <th>Description</th>
                            </tr>

                        </thead>


                        <tbody valign="middle" class="tbody">
                            <tr valign="middle">
                                <td align="left"><code class="code">launchPermission</code></td>

                                <td align="left">
                                    <p class="para">
                                        Controls who has permission to launch the
                                        <acronym class="acronym">AMI</acronym>. Launch permissions can be granted to
                                        specific users by adding userIds.
                                    </p>

                                    <p class="para">
                                        To make the <acronym class="acronym">AMI</acronym> public, add the all
                                        group.
                                    </p>
                                </td>
                            </tr>


                            <tr valign="middle">
                                <td align="left"><code class="code">productCodes</code></td>

                                <td align="left">
                                    <p class="para">
                                        Associates a product code with <b><tt>AMIs</tt></b>.
                                        This allows developers to charge users for using
                                        <b><tt>AMIs</tt></b>. The user must be signed up for
                                        the product before they can launch the
                                        <acronym class="acronym">AMI</acronym>. <em class="emphasis">This is a write once
                                            attribute; after it is set, it cannot be changed or
                                            removed.</em>
                                    </p>
                                </td>
                            </tr>

                        </tbody>
                    
                </table>

            </p></div>

            <div class="example-contents"><p>
                <code class="code">modifyAttribute</code> returns boolean <b><tt>TRUE</tt></b> or
                <b><tt>FALSE</tt></b>.
            </p></div>

            <pre class="programlisting brush: php">
$ec2_img = new Zend_Service_Amazon_Ec2_Image(&#039;aws_key&#039;,&#039;aws_secret_key&#039;);
// modify the launchPermission of an AMI
$return = $ec2_img-&gt;modifyAttribute(&#039;imageId&#039;,
                                    &#039;launchPermission&#039;,
                                    &#039;add&#039;,
                                    &#039;userId&#039;,
                                    &#039;userGroup&#039;);

// set the product code of the AMI.
$return = $ec2_img-&gt;modifyAttribute(&#039;imageId&#039;,
                                    &#039;productCodes&#039;,
                                    &#039;add&#039;,
                                    null,
                                    null,
                                    &#039;productCode&#039;);
</pre>

        </div>

        <div class="example" id="zend.service.amazon.ec2.images.attribute.reset"><div class="info"><p><b>Example #5 Reset an AMI Attribute</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">resetAttribute</code> will reset the attribute of an <acronym class="acronym">AMI</acronym> to
                its default value. <em class="emphasis">The productCodes attribute cannot be reset.</em>
            </p></div>

            <pre class="programlisting brush: php">
$ec2_img = new Zend_Service_Amazon_Ec2_Image(&#039;aws_key&#039;,&#039;aws_secret_key&#039;);
$return = $ec2_img-&gt;resetAttribute(&#039;imageId&#039;, &#039;launchPermission&#039;);
</pre>

        </div>

        <div class="example" id="zend.service.amazon.ec2.images.attribute.describe"><div class="info"><p><b>Example #6 Describe AMI Attribute</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">describeAttribute</code> returns information about an attribute of an
                <acronym class="acronym">AMI</acronym>. Only one attribute can be specified per call. Currently only
                launchPermission and productCodes are supported.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">describeAttribute</code> returns an array with the value of the attribute
                that was requested.
            </p></div>

            <pre class="programlisting brush: php">
$ec2_img = new Zend_Service_Amazon_Ec2_Image(&#039;aws_key&#039;,&#039;aws_secret_key&#039;);
$return = $ec2_img-&gt;describeAttribute(&#039;imageId&#039;, &#039;launchPermission&#039;);
</pre>

        </div>
    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.service.amazon.ec2.cloudwatch.html">Zend_Service_Amazon_Ec2: CloudWatch Monitoring</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.service.html">Zend_Service</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.service.amazon.ec2.ebs.html">Zend_Service_Amazon_Ec2: Elastic Block Storage (EBS)</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.service.html">Zend_Service</a></li>
  <li><a href="zend.service.introduction.html">Introdu&ccedil;&atilde;o</a></li>
  <li><a href="zend.service.akismet.html">Zend_Service_Akismet</a></li>
  <li><a href="zend.service.amazon.html">Zend_Service_Amazon</a></li>
  <li><a href="zend.service.amazon.ec2.html">Zend_Service_Amazon_Ec2</a></li>
  <li><a href="zend.service.amazon.ec2.instance.html">Zend_Service_Amazon_Ec2: Instances</a></li>
  <li><a href="zend.service.amazon.ec2.windows.instance.html">Zend_Service_Amazon_Ec2: Windows Instances</a></li>
  <li><a href="zend.service.amazon.ec2.reserved.instance.html">Zend_Service_Amazon_Ec2: Reserved Instances</a></li>
  <li><a href="zend.service.amazon.ec2.cloudwatch.html">Zend_Service_Amazon_Ec2: CloudWatch Monitoring</a></li>
  <li class="active"><a href="zend.service.amazon.ec2.images.html">Zend_Service_Amazon_Ec2: Amazon Machine Images (AMI)</a></li>
  <li><a href="zend.service.amazon.ec2.ebs.html">Zend_Service_Amazon_Ec2: Elastic Block Storage (EBS)</a></li>
  <li><a href="zend.service.amazon.ec2.elasticip.html">Zend_Service_Amazon_Ec2: Elastic IP Addresses</a></li>
  <li><a href="zend.service.amazon.ec2.keypairs.html">Zend_Service_Amazon_Ec2: Keypairs</a></li>
  <li><a href="zend.service.amazon.ec2.zones.html">Zend_Service_Amazon_Ec2: Regions and Availability Zones</a></li>
  <li><a href="zend.service.amazon.ec2.securitygroups.html">Zend_Service_Amazon_Ec2: Security Groups</a></li>
  <li><a href="zend.service.amazon.s3.html">Zend_Service_Amazon_S3</a></li>
  <li><a href="zend.service.amazon.sqs.html">Zend_Service_Amazon_Sqs</a></li>
  <li><a href="zend.service.audioscrobbler.html">Zend_Service_Audioscrobbler</a></li>
  <li><a href="zend.service.delicious.html">Zend_Service_Delicious</a></li>
  <li><a href="zend.service.developergarden.html">Zend_Service_DeveloperGarden</a></li>
  <li><a href="zend.service.ebay.html">Zend_Service_Ebay</a></li>
  <li><a href="zend.service.ebay.finding.html">Zend_Service_Ebay_Finding</a></li>
  <li><a href="zend.service.flickr.html">Zend_Service_Flickr</a></li>
  <li><a href="zend.service.livedocx.html">Zend_Service_LiveDocx</a></li>
  <li><a href="zend.service.nirvanix.html">Zend_Service_Nirvanix</a></li>
  <li><a href="zend.service.recaptcha.html">Zend_Service_ReCaptcha</a></li>
  <li><a href="zend.service.short-url.html">Zend_Service_ShortUrl</a></li>
  <li><a href="zend.service.simpy.html">Zend_Service_Simpy</a></li>
  <li><a href="zend.service.slideshare.html">Zend_Service_SlideShare</a></li>
  <li><a href="zend.service.strikeiron.html">Zend_Service_StrikeIron</a></li>
  <li><a href="zend.service.strikeiron.bundled-services.html">Zend_Service_StrikeIron: Bundled Services</a></li>
  <li><a href="zend.service.strikeiron.advanced-uses.html">Zend_Service_StrikeIron: Advanced Uses</a></li>
  <li><a href="zend.service.technorati.html">Zend_Service_Technorati</a></li>
  <li><a href="zend.service.twitter.html">Zend_Service_Twitter</a></li>
  <li><a href="zend.service.windowsazure.html">Zend_Service_WindowsAzure</a></li>
  <li><a href="zend.service.windowsazure.storage.blob.html">Zend_Service_WindowsAzure_Storage_Blob</a></li>
  <li><a href="zend.service.windowsazure.diagnostics.manager.html">Zend_Service_WindowsAzure_Diagnostics_Manager</a></li>
  <li><a href="zend.service.windowsazure.storage.queue.html">Zend_Service_WindowsAzure_Storage_Queue</a></li>
  <li><a href="zend.service.windowsazure.storage.table.html">Zend_Service_WindowsAzure_Storage_Table</a></li>
  <li><a href="zend.service.yahoo.html">Zend_Service_Yahoo</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>